package com.suiwei.advanced.designPattern;
/**
 * @author suiwei
 * @date 2023/5/1 19:30
 */


public abstract class Template {
  public static void main(String[] args){
    Tom tom = new Tom();
    tom.write();
  }

}
class Tom extends Composition{

  @Override
  public void body() {
    System.out.println("他很高！");
  }
}

abstract class Composition {
  //为了防止破坏结构，加入final修饰
  public final void write() {
    System.out.println("《我的爸爸》");
    body();
    System.out.println("这就是我的爸爸");
  }

  public abstract void body();
}
